CFLAGS = -g -fPIC \
		 -Wall \
		 -pedantic \
		 -I../../include \
		 -I.
LDFLAGS = -L../../lib \
		  -llua \
		  -lluabindd \
		  -lopencv_core \
		  -lopencv_highgui

LIB = CamDriver.so

BIND = $(LIB:.so=.bind)
BINDO = $(BIND:.bind=.bindo)
SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)

#################
## MAKE TARGET ##
#################

all: $(LIB)

$(LIB): $(BINDO)
	g++ -shared $(LDFLAGS) $(CFLAGS) $^ -o $@

%.o: %.cpp
	g++ $(CFLAGS) -c $< -o $@

%.bindo: %.bind $(OBJ)
	g++ $(CFLAGS) -c $< -o $@ $(OBJ)

clean:
	$(RM) *.o *.so

mrproper: clean
	$(RM) $(LIB)

